package cc.comac.mom.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import cc.comac.mom.api.QualityPlanToDoService;
import cc.comac.mom.bean.QualityPlanToDo;
import cc.comac.mom.util.ResultBean;
import io.swagger.annotations.ApiOperation;

@RestController
@RequestMapping("/QualityPlanToDo")
public class QualityPlanToDoController {

	@Autowired
	private QualityPlanToDoService qualityPlanToDoService;
	
	@ApiOperation("插入计划待办")
	@RequestMapping(value = "/insert",method = RequestMethod.POST)
	public ResultBean insert(@RequestBody QualityPlanToDo obj) {
		return qualityPlanToDoService.insert(obj);
	}
	
	@ApiOperation("计划待办确认")
	@RequestMapping(value = "/planConfirmBatch",method = RequestMethod.POST)
	public ResultBean planConfirmBatch(@RequestBody List<Long> ids) {
		return qualityPlanToDoService.planConfirmBatch(ids);
	}
	
	@ApiOperation("查询计划待办")
	@RequestMapping(value = "/selectByCondition",method = RequestMethod.POST)
	public ResultBean selectByCondition(@RequestBody QualityPlanToDo obj) {
		return qualityPlanToDoService.selectByCondition(obj);
	}
	
	@ApiOperation("获取未处理的计划代办信息通过零件号和待办类型 ,toDoType 待办类型 1.驳回，2.母本异常 3.母本升版")
	@RequestMapping(value = "/getUnTreatedByPartNoAndToDoStatus",method = RequestMethod.POST)
	public ResultBean getUnTreatedByPartNoAndToDoStatus(@RequestParam(value="partNo")String partNo, @RequestParam(value="toDoType")int toDoType) {
		return qualityPlanToDoService.getUnTreatedByPartNoAndToDoStatus(partNo, toDoType);
	}
}
